<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<title>商品详情</title>
	<link rel="stylesheet" type="text/css" href="https://at.alicdn.com/t/font_474420_0o6wv3e9gbbuik9.css">
	<link rel="stylesheet" type="text/css" href="css/swiper.min.css">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<script type="text/javascript" src="js/fontSize.js"></script>
	<script type="text/javascript" src="js/layer/layer.js"></script>
	<script type="text/javascript" src="js/zepto.min.js"></script>
	<script type="text/javascript" src="js/swiper.min.js"></script>
	<script type="text/javascript" src="js/vue.js"></script>
	<script type="text/javascript" src="js/jweixin-1.2.0.js"></script>
	<script type="text/javascript" src="js/config.js"></script>
</head>
<body class="bgcolor shopDetail">
<div id="app">
	<!-- 选择弹窗 -->
	<div class="mask_layer" v-show="flag">
		<div class="mask_model" @click="toogle"></div>
		<div class="choice_content">
			<div class="choice_info">
				<div class="choice_left">
					<span>
						<img :src="resObj.good.url" alt="">
					</span>
				</div>
				<ul class="choice_price">
					<li v-if="resObj.coupon!=null">价格：￥{{resObj.coupon.price}} <del>￥{{resObj.good.price}}</del></li>
					<li v-else>价格：￥{{resObj.good.price}}</li>
					<li>请选择</li>
				</ul>
			</div>
			<div class="choice_title">数量</div>
			<div class="choice_num">
				<button type="button" class="fl minns" @click="reduceNum" :disabled="num==1?true:false">-</button>
				<div class="fl inputDiv"><input type="text" v-model.trim="num"></div>
				<button type="button" class="fl plus" @click="addNum">+</button>
			</div>
			<ul class="tab_confirm_buy borderTop">
				<li></li>
				<li>确定购买</li>
			</ul>
		</div>
	</div>
	<!-- 选择弹窗 -->



	<div class="shop_detail_img">
		<span>
			<img :src="resObj.good.url" alt="">
		</span>
		<div class="shopList_bottom1"  v-if="resObj.coupon!=null">
			<div class="shop_buttton" :style="'background-image:url('+resObj.coupon.url+')'">
				{{resObj.coupon.desc}}
			</div>
		</div>	
	</div>
	
	<ul class="shop_detail_info">
		<li class="shop_detail_name">{{resObj.good.name}}</li>
		<li class="shop_detail_desc">{{resObj.good.desc}}</li>
		
		<li class="shop_detail_price" v-if="resObj.coupon!=null">￥{{resObj.coupon.price}} <del>￥{{resObj.good.price}}</del></li>
		<li class="shop_detail_price" v-else>￥{{resObj.good.price}}</li>
	</ul>
	<ul class="tab_go_buy borderTop">
		<li></li>
		<li @click="toogle">立即购买</li>
	</ul>
	<!-- <img src="img/p_75.png" alt="" class="img"> -->

	
</div>
<script type="text/javascript">
	 var app = new Vue({
			el: '#app',
			data: {
			    list:[],
		        unionid:GetQueryString("unionid"),
		        token:GetQueryString("token"),
		        id:GetQueryString("id"),
		        flag:false,
		        resObj:{
		        	good:{

		        	}
		        },
		        num:1
		       
			},
			mounted(){
			  this.getDetail();
			},
			methods:{
				toogle:function(){
				   window.location.href="choice.html?token="+this.token+"&unionid="+this.unionid+"&shopId="+this.id;

					// window.location.href=""
					// this.flag=!this.flag;
				},
				addNum(){
					this.num++; 
				},
				reduceNum(){
					if(this.num==1){
						showLayer("购买数量必须为1哟");
						return;
					}
					this.num--; 
				},
				getDetail(){
					var that=this;
					ajaxFun("GET","/trade/good/detail",{
	                       token:this.token,
	                       id:this.id
	              
	                    },function(data){
	                    	if(data.error==0){
                              that.resObj=data.good;
	                    	}else{

	                    	}
	                     
                    }); 
				},
				order(){
					var that=this;
					ajaxFun("GET","/trade/order/save",{
	                        token:this.token,
						    gid:this.id,
						    count:this.num
						    // aid:
						    // spec:可选，商品规格
	              
	                    },function(data){
	                    	if(data.error==0){
                              that.resObj=data.good;
	                    	}else{

	                    	}
	                     
                    });
				}
			}
		});
</script>	
</body>
</html>